<!-- S search -->
<app-search-bar
  [submitLoading]="tableParams.loading"
  [searchOptions]="searchOptions"
  labelFlex="80px"
  (onSearch)="queryResetData($event)"
  (onReset)="queryResetData($event)"
>
</app-search-bar>
<!-- E search -->

<nz-card class="m-t-2">
  <div class="pagination-wrap-position">
    <nz-table
      #basicTable
      nzSize="small"
      nzShowSizeChanger
      nzShowQuickJumper
      nzOuterBordered
      [nzScroll]="{ x: '1100px' }"
      [nzFrontPagination]="false"
      [nzLoadingDelay]="100"
      [nzLoading]="tableParams.loading"
      [nzData]="tableParams.tableData"
      [nzPageSizeOptions]="[5, 10, 20, 50, 100]"
      [nzTotal]="tableParams.total"
      [nzPageIndex]="tableParams.page"
      [nzPageSize]="tableParams.pageSize"
      [nzShowTotal]="totalTemplate"
      (nzPageIndexChange)="onPageIndexChange($event)"
      (nzPageSizeChange)="onPageSizeChange($event)"
    >
      <thead>
        <tr>
          <th nzAlign="center" nzWidth="120px" nzLeft>ID</th>
          <th nzAlign="center" nzWidth="200px">公司名称</th>
          <th nzAlign="center" nzWidth="200px">公司地址</th>
          <th nzAlign="center" nzWidth="180px">组织机构代码</th>
          <th nzAlign="center" nzWidth="150px">公司联系电话</th>
          <th nzAlign="center" nzWidth="150px">公司联系邮箱</th>
          <th nzAlign="center" nzWidth="120px">商务联系人</th>
          <th nzAlign="center" nzWidth="150px">商务联系电话</th>
          <th nzAlign="center" nzWidth="120px">文网文</th>
          <th nzAlign="center" nzWidth="120px">ICP证</th>
          <th nzAlign="center" nzWidth="120px">营业执照</th>
          <th nzAlign="center" nzWidth="120px">状态</th>
          <th nzAlign="center" nzWidth="170px">申请时间</th>
          <th nzAlign="center" nzWidth="180px" nzRight>操作</th>
        </tr>
      </thead>

      <tbody>
        <tr *ngFor="let data of basicTable.data; let index = index;">
          <!-- ID -->
          <td nzAlign="center" nzLeft>{{ data.id }}</td>
          <!-- 公司名称 -->
          <td nzAlign="center">{{ data.companyName || '-' }}</td>
          <!-- 公司地址 -->
          <td nzAlign="center">{{ data.companyAddress || '-' }}</td>
          <!-- 组织机构代码 -->
          <td nzAlign="center">{{ data.uscc || '-' }}</td>
          <!-- 公司联系电话 -->
          <td nzAlign="center">{{ data.companyTel || '-' }}</td>
          <!-- 公司联系邮箱 -->
          <td nzAlign="center">{{ data.companyEmail || '-' }}</td>
          <!-- 商务联系人 -->
          <td nzAlign="center">{{ data.contactsName || '-' }}</td>
          <!-- 商务联系电话 -->
          <td nzAlign="center">{{ data.contactsTel || '-' }}</td>
          <!-- 文网文 -->
          <td nzAlign="center">
            <span class="td-img">
              <img
                nz-image
                [nzSrc]="data.www"
                [nzFallback]="fallback"
                alt=""
              />
            </span>
          </td>
          <!-- ICP证 -->
          <td nzAlign="center">
            <span class="td-img">
              <img
                nz-image
                [nzSrc]="data.icp"
                [nzFallback]="fallback"
                alt=""
              />
            </span>
          </td>
          <!-- 营业执照 -->
          <td nzAlign="center">
            <span class="td-img">
              <img
                nz-image
                [nzSrc]="data.businessLicense"
                [nzFallback]="fallback"
                alt=""
              />
            </span>
          </td>
          <!-- 状态 -->
          <td nzAlign="center">
            <span [ngStyle]="{'color': data.status | divideDeveloperStatus: 'color'}">
              {{ data.status | divideDeveloperStatus: 'label' }}
            </span>
          </td>
          <!-- 申请时间 -->
          <td nzAlign="center">{{ data.applicationTime || '-' }}</td>
          <!-- 操作 -->
          <td nzAlign="center" nzRight>
            <ng-container *ngIf="[1,2,3].includes(data.status); else elseBtnTemplate">
              <button
                nz-button
                nzType="link"
                nzSize="small"
                routerLink="/promotionshare/divide-developer-details"
                [queryParams]="{id: data.id}"
              >查看</button>

              <button
                *ngIf="data.status === 1"
                nz-button
                nzType="link"
                nzSize="small"
                (click)="showExamineModal(data)"
              >审核</button>
            </ng-container>
            <ng-template #elseBtnTemplate>
              -
            </ng-template>
          </td>
        </tr>
      </tbody>
    </nz-table>

    <!-- 分页template -->
    <ng-template #totalTemplate let-total>共有 {{ total }} 条</ng-template>
  </div>
</nz-card>

<!-- S 审核 Modal -->
<nz-modal
  nzClassName="custom-model-wrap"
  [nzFooter]="null"
  [(nzVisible)]="isExamineVisible"
  [nzTitle]="'审核'"
  (nzOnCancel)="isExamineVisible = false">

  <div *nzModalContent>
    <div class="custom-model-body">
      <nz-textarea-count [nzMaxCharacterCount]="150">
        <textarea
          rows="4"
          nz-input
          maxlength="150"
          placeholder="请输入审核意见"
          [(ngModel)]="auditOpinion"
        ></textarea>
      </nz-textarea-count>
    </div>

    <div class="custom-model-foot">
      <div class="custom-foot-cont">
        <button nz-button nzType="primary" (click)="subExamine(2)">审核通过</button>
        <button nz-button nzType="primary" nzDanger (click)="subExamine(3)">审核不通过</button>
      </div>
    </div>
  </div>
</nz-modal>
<!-- E 审核 Modal -->